package ld.oauth.blog.mapper.question;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import ld.oauth.blog.model.po.question.Question;
import ld.oauth.blog.model.qo.QuestionQo;
import ld.oauth.blog.model.vo.LabelVo;
import ld.oauth.blog.model.vo.QuestionDetail;
import ld.oauth.blog.model.vo.ReplyVo;
import ld.oauth.blog.utils.PageResult;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author ld
 * @since 2022-09-25
 */
public interface QuestionMapper extends BaseMapper<Question> {

    /**
     * 根据问题id查询标签集合
     * @param questionId
     * @return
     */
    List<LabelVo> selectLabelVoListByQuestionId(@Param("questionId")Integer questionId);

    /**
     * 分页条件查询最热问题
     * @param questionQo
     * @param page
     * @return
     */
    PageResult<QuestionDetail> hot(@Param("questionQo")QuestionQo questionQo, @Param("page")IPage<QuestionDetail> page);

    /**
     * 分页条件查询最新问题
     * @param questionQo
     * @param page
     * @return
     */
    PageResult<QuestionDetail> veryNew(@Param("questionQo")QuestionQo questionQo, @Param("page")IPage<QuestionDetail> page);

    /**
     * 分页条件查询等待问题
     * @param questionQo
     * @param page
     * @return
     */
    PageResult<QuestionDetail> wait(@Param("questionQo")QuestionQo questionQo, @Param("page")IPage<QuestionDetail> page);


    /**
     * 根据问题id获取问题的所有回答
     * @param questionId
     * @param parentId
     * @return
     */
    List<ReplyVo> getQuestionReplayById(@Param("questionId")Integer questionId, @Param("parentId")Integer parentId);

    /**
     * 根据标签id分页查询问题列表
     * @param questionQo
     * @param page
     * @return
     */
    PageResult<QuestionDetail> queryQuestionByLabelId(@Param("questionQo")QuestionQo questionQo, @Param("page")IPage<QuestionDetail> page);
}
